<%-- 
    Document   : detailAbsence
    Created on : 3 déc. 2013, 16:05:35
    Author     : jackson
--%>

<%@page import="com.myapp.struts.modele.Etudiant"%>
<%@page import="com.myapp.struts.modele.Cours"%>
<%@page import="com.myapp.struts.modele.EstAbsent"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
   <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">


        <!-- Bootstrap core CSS -->
        <link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="http://getbootstrap.com/examples/signin/signin.css" rel="stylesheet">

        <!-- Just for debugging purposes. Don't actually copy this line! -->
        <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
        <style type="text/css"></style></head>
       <jsp:useBean id="detailAbsence" scope="session" type="com.myapp.struts.modele.Matiere"/>
        <jsp:useBean id="bd" scope="session" type="com.myapp.struts.modele.QueryBD"/>
        <div class="container"><center><h1> 
                <% out.print(detailAbsence.getNom());%>
        </h1>
        <h2>Detail des absences</h2>
            <% 
                int i = detailAbsence.getAbsence().get(bd.getEtudiant()).getNbTotalAbsence();
                
                //out.print(i);

                
                if(i>0 && i<3){
                    out.print("<center><h2 class='text-success'><span class='glyphicon glyphicon-ok-sign'></span></h2></center>");
                    out.print("<TABLE class='table table-hover'><thead><tr><th><center> Matière </center></th><th><center> Date  </center></th><th><center> Heure début  </center></th><th><center> Heure Fin  </center></th></tr></thead>"); 
                    for (int j=0; j < i; j++){
                            out.print("<TR class='success'>");
                            out.print("<TD><center>" + detailAbsence.getNom() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getDateCours() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureDeb() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureFin() + "</center></TD>");
                            out.print("</TR>");
                    }
                }else if(i==3){
                    out.print("<center><h2 class='text-warning'><span class='glyphicon glyphicon-warning-sign'> Vous avez déjà 3 absences dans cette matière !</span></h2></center>");
                    out.print("<TABLE class='table table-hover'><thead><tr><th><center> Matière </center></th><th><center> Date  </center></th><th><center> Heure début  </center></th><th><center> Heure Fin  </center></th></tr></thead>"); 
                    for (int j=0; j < i; j++){
                            out.print("<TR class='warning'>");
                            out.print("<TD><center>" + detailAbsence.getNom() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getDateCours() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureDeb() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureFin() + "</center></TD>");
                            out.print("</TR>");
                        }
                }else if(i>3){
                    out.print("<center><h2 class='text-danger'><span class='glyphicon glyphicon-minus-sign'> Vous êtes défaillant dans cette matière !</span></h2></center>");
                    out.print("<TABLE class='table table-hover'><tr><th> Matière </th><th> Date  </th><th> Heure début  </th><th> Heure Fin  </th></tr>"); 
                    for (int j=0; j < i; j++){
                            out.print("<TR class='danger'>");
                            out.print("<TD><center>" + detailAbsence.getNom() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getDateCours() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureDeb() + "</center></TD>");
                            out.print("<TD><center>" + detailAbsence.getCours().get(j).getHeureFin() + "</center></TD>");
                            out.print("</TR>");
                        }
                } 
            %>
        </TABLE>
        </center>
        </div>
    </body>
</html>
